﻿//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
// 此文件由工具自动生成，请勿直接修改。
// 生成时间：2024-12-30 16:18:49.680
//------------------------------------------------------------

using GameFramework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
using UnityGameFramework.Runtime;

namespace ProjectMG
{
    /// <summary>
    /// COMMENT。
    /// </summary>
    public class DRScene : DataRowBase
    {
        private int m_Id = 0;

        /// <summary>
        /// 获取场景编号。
        /// </summary>
        public override int Id
        {
            get
            {
                return m_Id;
            }
        }

        /// <summary>
        /// 获取场景名称。
        /// </summary>
        public string SceneName
        {
            get;
            private set;
        }

        /// <summary>
        /// 获取资源名称。
        /// </summary>
        public string AssetName
        {
            get;
            private set;
        }

        /// <summary>
        /// 获取背景音乐编号。
        /// </summary>
        public int BackgroundMusicId
        {
            get;
            private set;
        }

        /// <summary>
        /// 获取默认打开界面ID组。
        /// </summary>
        public int[] OpenUIFormIdArray
        {
            get;
            private set;
        }

        public override bool ParseDataRow(string dataRowString, object userData)
        {
            string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
            for (int i = 0; i < columnStrings.Length; i++)
            {
                columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
            }

            int index = 0;
            int? key = null;
            try
            {
                m_Id = int.Parse(columnStrings[index++]);
                key = m_Id;
                index++;
                SceneName = columnStrings[index++];
                AssetName = columnStrings[index++];
                BackgroundMusicId = int.Parse(columnStrings[index++]);
                OpenUIFormIdArray = DataTableExtension.ParseArray<int>(columnStrings[index++]);
                index++;
            }
            catch (Exception e)
            {
                ((DataTableHelper.ParseDataRowError)userData).Set(index, key, e);
                return false;
            }

            return true;
        }

        public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
        {
            Tuple<BinaryReader, GameFrameworkFunc<int, string>> tuple = (Tuple<BinaryReader, GameFrameworkFunc<int, string>>)userData;
            BinaryReader binaryReader = tuple.Item1;
            GameFrameworkFunc<int, string> GetString = tuple.Item2;

            m_Id = binaryReader.Read7BitEncodedInt32();
            SceneName = binaryReader.ParseSystemType<string>();
            AssetName = binaryReader.ParseSystemType<string>();
            BackgroundMusicId = binaryReader.ParseSystemType<int>();
            OpenUIFormIdArray = binaryReader.ParseArray<int>();

            return true;
        }

        // No Property Collection
    }
}
